Skip to content

feat: introduce list for fatal status codes#362

Merged
toddbaert merged 3 commits intoopen-feature:mainfrom
open-feature-forking:feat/fatal-status-code-list
Mar 19, 2026
Merged

feat: introduce list for fatal status codes#362
toddbaert merged 3 commits intoopen-feature:mainfrom
open-feature-forking:feat/fatal-status-code-list

Conversation

@leakonvalinka
Copy link
Member

@leakonvalinka leakonvalinka commented Mar 12, 2026

This PR

  • introduces the option of specifying a list of grpc status codes for which the provider should go into fatal state

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the flagd OpenFeature provider by introducing a configurable mechanism for handling gRPC errors. It allows the provider to be configured with a list of gRPC status codes that, if encountered, will trigger a ProviderFatalError, providing more granular control over error propagation and provider state management. This change improves the robustness and customizability of the provider's error handling.

Highlights

  • Configurable Fatal Status Codes: Introduced a fatal_status_codes parameter to the FlagdProvider constructor, allowing users to specify a list of gRPC status codes that should be treated as fatal errors.
  • Enhanced Error Handling: Implemented logic within the gRPC resolvers to raise a ProviderFatalError when an encountered gRPC RpcError matches one of the configured fatal status codes, providing more granular control over error propagation.
  • Updated End-to-End Tests: Modified end-to-end tests to accommodate the new fatal status code functionality, including exposing a new port in the FlagdContainer and updating BDD step definitions for flexible option parsing and provider status checks.
Changelog
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/provider.py
    • Added fatal_status_codes parameter to the FlagdProvider constructor.
    • Passed fatal_status_codes to the underlying GrpcResolver configuration.
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/grpc.py
    • Imported ProviderFatalError.
    • Added debug logging for fatal_status_codes.
    • Modified listen method to raise ProviderFatalError if an RpcError code is in fatal_status_codes.
    • Modified _resolve method to raise ProviderFatalError if an RpcError code is in fatal_status_codes before checking for NOT_FOUND or INVALID_ARGUMENT.
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/process/connector/grpc_watcher.py
    • Imported ProviderFatalError.
    • Changed logger.debug to logger.warning for SyncFlags stream errors.
    • Introduced _raise_on_fatal_status_code helper method to encapsulate the logic for raising ProviderFatalError.
    • Called _raise_on_fatal_status_code in the listen method's RpcError handler.
  • providers/openfeature-provider-flagd/tests/e2e/flagd_container.py
    • Added FORBIDDEN constant for a new port.
    • Exposed the FORBIDDEN port in FlagdContainer initialization.
  • providers/openfeature-provider-flagd/tests/e2e/inprocess/conftest.py
    • Removed ~forbidden from the feature_list.
  • providers/openfeature-provider-flagd/tests/e2e/rpc/conftest.py
    • Removed ~forbidden from the feature_list.
  • providers/openfeature-provider-flagd/tests/e2e/step/config_steps.py
    • Updated parsers.cfparse to parsers.re in @given and @then decorators for option value parsing.
  • providers/openfeature-provider-flagd/tests/e2e/step/provider_steps.py
    • Imported assert_equal and then from pytest_bdd.
    • Modified get_default_options_for_provider to handle TestProviderType.FORBIDDEN by setting wait=False and using container.get_exposed_port.
    • Added a new @then step client_state to assert the client's provider status.
Activity
  • The pull request introduces a new feature.
  • It addresses issue #1234523.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new feature to configure a list of gRPC status codes that should be considered fatal, which is a valuable addition for more robust error handling. The implementation is mostly sound, but I've identified a couple of critical issues in grpc_watcher.py that would lead to a TypeError at runtime. Specifically, a method is called with an incorrect number of arguments, and an exception is instantiated improperly. Additionally, I've noted a minor issue with a generic error message in grpc.py and a potential for test flakiness due to a commented-out wait_for call in the test steps.

Signed-off-by: Konvalinka <lea.konvalinka@dynatrace.com>
@leakonvalinka leakonvalinka force-pushed the feat/fatal-status-code-list branch from 8eb934c to 16956f5 Compare March 12, 2026 14:45
@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 90.56604% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.29%. Comparing base (7e3b06e) to head (52c283d).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
.../flagd/resolvers/process/connector/grpc_watcher.py 88.88% 4 Missing ⚠️
...enfeature/contrib/provider/flagd/resolvers/grpc.py 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #362      +/-   ##
==========================================
- Coverage   95.43%   95.29%   -0.15%     
==========================================
  Files          16       16              
  Lines         877      913      +36     
==========================================
+ Hits          837      870      +33     
- Misses         40       43       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Lea Konvalinka <lea.konvalinka@dynatrace.com>
@leakonvalinka leakonvalinka force-pushed the feat/fatal-status-code-list branch 2 times, most recently from 3304486 to ad0baf1 Compare March 16, 2026 14:19
@leakonvalinka leakonvalinka marked this pull request as ready for review March 16, 2026 14:29
@leakonvalinka leakonvalinka requested review from a team as code owners March 16, 2026 14:29
Signed-off-by: Lea Konvalinka <lea.konvalinka@dynatrace.com>
@leakonvalinka leakonvalinka force-pushed the feat/fatal-status-code-list branch from ad0baf1 to 52c283d Compare March 19, 2026 11:53
@toddbaert toddbaert self-requested a review March 19, 2026 13:53
@toddbaert toddbaert merged commit 96a88ad into open-feature:main Mar 19, 2026
14 of 16 checks passed
@toddbaert toddbaert deleted the feat/fatal-status-code-list branch March 19, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants